<div id="main-content">
  <div class="container-fluid">
    <div class="row-fluid">
      <div class="span12">
        <div class="widget-block">
          <div class="widget-head">
            <h5><?=$title_table?></h5>
          </div>
          <?php
         $keputusan_cek = $this->nbscache->get_olahan("permission", $this->session->userdata("id_privilege"), "dev_checklist_field", "edit");
          foreach($fase as $fs){
            $judul .= "
              <li id='cfase_{$fs->id_checklist_fase}' class='df'><a onclick='click_fase({$fs->id_checklist_fase})' href='javascript:void(0)'>{$fs->name}</a></li>
              ";
          }
          ?>
          <div class="widget-content">
            <div class="span12">
                <img style="display: none;" id="loadingbar" src="<?=$url?>img/loading_bar.gif" />
            </div>
          </div>
          <div class="widget-content">
            <div class="span12">
              <div class="box-tab">
                <div class="tabbable"> 
                  <!-- Only required for left/right tabs -->
                  <ul class="nav nav-tabs">
                    <?=$judul?>
                  </ul>
                  <div class="tab-content">
                    <div id="badan">
                      
                    </div>
                  </div>
                </div>
              </div>
            </div>
					</div>
        </div>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript">
  function simpan_cek(id, fase, urut){
      if ($('#cekbok'+id).is(":checked")){
        var kondisi = 1;
        $("#tanggal"+id).show();
        $("#tanggal"+id).val('<?=date("Y-m-d")?>');
        urut = urut + 1;
        $(".urut_"+fase+"_"+urut).show();
      }
      else{
        var kondisi = 0;
        $("#tanggal"+id).hide();
        $("#tanggal"+id).val('');
      }
      $.ajax({
        type: 'POST',
        url: '<?=site_url("dev-checklist/ajax-cek")?>',
        async:false,
        beforeSend: function(){
          
        },
        complete: function(){},
        data: { id: id, kondisi: kondisi, id_outlet: <?=$id_outlet?> }
        });
    }
    function click_fase(id){
      $(".df").removeClass("active");
      $("#cfase_"+id).addClass("active");
      $.ajax({
        type: 'POST',
        url: '<?=site_url("dev-checklist/ajax-get-data")?>/'+id,
        async:false,
        beforeSend: function(){
          $("#loadingbar").show();
        },
//        complete: function(){
//          $("#loadingbar").show();
//        },
        data: { id: id, id_outlet: <?=$id_outlet?> },
        success: function(data){
          $("#ajax").remove();
          $(data).clone(true).insertBefore("#badan");
//          $("#loadingbar").hide();
        }
      });
    }
    $( document ).ajaxStart(function() {
      $("#loadingbar").show();
    });
    $( document ).ajaxStop(function() {
      $("#loadingbar").hide();
    });
</script>